﻿using OpenTK.Mathematics;

namespace OpenGl.Explore.FirstApp
{
    public class OpenglTransform
    {
        private Matrix4 _transformMatrix;

        public Matrix4 TransformMatrix => _transformMatrix;

        public static OpenglTransform Identity => new OpenglTransform()
        {
            _transformMatrix = Matrix4.Identity
        };

        public void SetScale(float ratio)
        {
            _transformMatrix = _transformMatrix * Matrix4.CreateScale(ratio);
        }

        public void SetRotation(Vector3 aixs, float angle)
        {
            _transformMatrix = _transformMatrix *  Matrix4.CreateFromQuaternion(Quaternion.FromAxisAngle(aixs, angle));
        }

        public void SetTranslation(Vector3 vector)
        {
            _transformMatrix = _transformMatrix * Matrix4.CreateTranslation(vector);
        }
    }
}
